import QtQuick 2.12
import QtQuick.Controls 2.5

Page {
    id: page
    width: 400
    height: 600

    title: qsTr("设置")
    property QtObject config: servic.getConfig()

    Column {
        id: column
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 10
        anchors.top: parent.top
        anchors.topMargin: 10
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.right: parent.right
        anchors.rightMargin: 10
        spacing: 5

        Text {
            id: element
            text: qsTr("服务地址IP")
            font.pixelSize: 12
        }

        TextField {
            id: textField
            height: 30
            anchors.left: parent.left
            anchors.right: parent.right

            text: config.ip
            placeholderText: qsTr("连接服务器的地址")
              onTextChanged: config.ip=text
        }

        Text {
            id: element1
            text: qsTr("服务端口")
            anchors.left: parent.left
            anchors.right: parent.right
            font.pixelSize: 12
        }

        TextField {
            id: textField1
            height: 30
            text: config.port
            anchors.left: parent.left
            anchors.right: parent.right
            placeholderText: qsTr("连接服务器的地址端口号")
              onTextChanged: config.port=Number(text)
        }

        Text {
            id: element2
            text: qsTr("重连时间")
            anchors.left: parent.left
            anchors.right: parent.right
            font.pixelSize: 12
        }

        TextField {
            id: textField2
            height: 30
            text: config.relink
            anchors.left: parent.left
            anchors.right: parent.right
            placeholderText: qsTr("连接失败时重新连接时间毫秒")
              onTextChanged: config.relink=Number(text)
        }

        Text {
            id: element3
            text: qsTr("项目")
            anchors.left: parent.left
            anchors.right: parent.right
            font.pixelSize: 12
        }

        TextField {
            id: textField3
            height: 30
            text: config.item
            anchors.left: parent.left
            anchors.right: parent.right
            placeholderText: qsTr("使用应用项目")
              onTextChanged: config.item=text
        }

        Text {
            id: element4
            text: qsTr("标题")
            anchors.left: parent.left
            anchors.right: parent.right
            font.pixelSize: 12
        }

        TextField {
            id: textField4
            height: 30
            text: config.title
            anchors.left: parent.left
            anchors.right: parent.right
            placeholderText: qsTr("分项目处理")
              onTextChanged: config.title=text
        }

        Text {
            id: element5
            text: qsTr("通信分组")
            anchors.left: parent.left
            anchors.right: parent.right
            font.pixelSize: 12
        }

        TextField {
            id: textField5
            height: 30
            text: config.group
            anchors.left: parent.left
            anchors.right: parent.right
            placeholderText: qsTr("在服务器中分组交互通信")
              onTextChanged: config.group=text
        }

        Text {
            id: element6
            text: qsTr("应用ID")
            anchors.left: parent.left
            anchors.right: parent.right
            font.pixelSize: 12
        }

        TextField {
            id: textField6
            height: 30
            text: config.appid
            anchors.left: parent.left
            anchors.right: parent.right
            placeholderText: qsTr("服务器中识别应用来源")
              onTextChanged: config.appid=text
        }

        Text {
            id: element7
            text: qsTr("路径")
            anchors.left: parent.left
            anchors.right: parent.right
            font.pixelSize: 12
        }

        TextField {
            id: textField7
            height: 30
            text: config.dir
            anchors.left: parent.left
            anchors.right: parent.right
            placeholderText: qsTr("数据路径")
              onTextChanged: config.dir=text
        }

        Text {
            id: element8
            text: qsTr("备份")
            anchors.left: parent.left
            anchors.right: parent.right
            font.pixelSize: 12
        }

        TextField {
            id: textField8
            height: 30
            text: config.batdir
            anchors.left: parent.left
            anchors.right: parent.right
            placeholderText: qsTr("操作备份路径")
            onTextChanged: config.batdir=text
        }

        Button {
            id: button
            text: qsTr("保存")
            onClicked: config.save()
        }
    }
}



